package com.server.user.controller.feignController;

import com.server.common.code.utils.ResultUtil;
import com.server.model.all.user.bo.LoginBo;
import com.server.model.all.user.bo.SmsLoginBo;
import com.server.common.code.utils.Result;
import com.server.common.code.vo.LoginVo;
import com.server.common.security.code.anntation.Log;
import com.server.user.service.UserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/systemUser/private")
public class FeignUserController {

    @Resource
    private UserService userService;

    /**
     * 登录
     * @author LXC
     * @date 2022/4/28 13:39
     */
    @Log
    @PostMapping("/login")
    public Result<LoginVo> login(@RequestBody @Validated LoginBo loginBo){
        return ResultUtil.successData(userService.login(loginBo));
    }


    /**
     * 短信登录
     * @author LXC
     * @date 2022/4/28 13:39
     */
    @Log
    @PostMapping("/smsLogin")
    public Result<LoginVo> smsLogin(@RequestBody @Validated SmsLoginBo smsLoginBo){
        return ResultUtil.successData(userService.smsLogin(smsLoginBo));
    }

}
